<template>
<div class="main">
  <!-- 头部导航栏 -->
  <head-component :noBack="false" title="消息"/>

  <div class="con">
    <div class="list"  v-for="(item,i) in newsList" :key="i">
      <div class="list_l bg_409aff" v-if="item.log_status == 0"></div>
      <div class="list_r">
        <div class="list_r_t">
          <p class="f36 oneline col_33">{{item.log_title}}</p>
          <p class="f28 col_99">{{item.log_addtime}}</p>
        </div>
        <div class="txt f28 col_66">{{item.log_content}}</div>
      </div>
    </div>
    <!-- 如果内容列表为空 -->
    <div class="null_list" v-if="newsList == ''">
      <img class="null_img" src="@/common/icon/nothing.png" alt="">
      <div class="null_title">暂无数据</div>
    </div>
  </div>
</div>
</template>

<script>
import headComponent from '@/components/layout/head';
export default {
    name: "news.vue",
    data() {
      return {
        rightIcon: require("@/common/icon/add.png"),
        newsList:[],
      }
    },
    created(){
      var $this = this;
      var t = this.$toast.loading({message:'正在加载数据',mask:true, duration:9999})
      var data = {u_id: localStorage.getItem('uid'),token:localStorage.getItem('token')};
      $this.$axios.post('index.php?m=index&c=about_msg',data)
        .then((res) => {
          t.clear();
          if(res.data.code == 1){
            $this.newsList = res.data.notice;
          }else if(res.data.code == 0){
            $this.$toast({
              message: '请先登录',
              duration: 800,
              onClose:()=>{
                $this.$router.push('/login');
              }
            })
          }else{

          }
        })
    },
   components: {
     headComponent,
   },
}
</script>

<style scoped lang="less">
  .main{width: 100%;height: 100%;background: #f5f5f5;overflow:auto}
  .layout-head{background: #fff}
  .oneline{white-space: nowrap;text-overflow: ellipsis;overflow: hidden;}
  .con{
    width: 92%;
    margin: 1.8rem auto 0.9rem;
    .list{padding:0.53rem 0.4rem;margin-bottom: 0.53rem;overflow: hidden;border-radius: 0.12rem;background: #fff;
      .list_l{width: 0.14rem;height: 0.14rem;border-radius: 100%;float: left;margin-top: 0.23rem; background: #fd5f5f;}
      .list_r{ width: 95%;float: left;margin-left: 0.26rem;
        .list_r_t{ overflow: hidden;line-height: 0.6rem;
          p:nth-child(1){float: left;width: 53%;}
          p:nth-child(2){float: right; }
        }
        .txt{ width: 100%; line-height: 0.6rem;margin-top: 0.26rem;}
      }
    }
  }
</style>
